<template>
    <div class="cardWarp">
        <!-- 商品图片 -->
        <img :src="imgSrc" alt="" class="goodImg">
        <!-- 商品信息 -->
        <div class="goodInfo">
            <p class="title">{{name}}</p>
            <div class="priceLine">
                <img src="@/assets/images/stLine-coin-l.svg" alt="" class="money">
                <span class="price">{{priceDay+'/日 '+priceMonth*20+'/月'}}</span>
            </div>
        </div>
    </div>
</template>
    
<script setup >
    import {computed} from 'vue'
    const props = defineProps({
        name:{
            type:String,
            default:'我是默认值'
        },
        priceDay:{
            type:Number,
            default:'我是默认值'
        },
        priceMonth:{
            type:Number,
            default:'我是默认值'
        },
        imgSrc:{
            type:String,
            default: require('@/assets/images/goods.png')
        }
    })

    let imgSrc = computed(()=>{
        return props.imgSrc.split(',')[0];
    })


</script>
    
<style lang="scss" scoped>
.cardWarp{
    width: 2.8rem;
    height: 1.7rem;
    background: #ffffff;
    border-radius: 20px;
    position: relative;
    display: flex;
    justify-content: flex-start;
    img.goodImg{
        border-radius: 20px;
        margin:0.25rem 0 0 0.1rem;
        width: 1.2rem;
        height: 1.2rem;
    }
    /* 商品信息 */
    .goodInfo{
        width: 1.45rem;
        height: 1.4rem;

        p.title{
            width: 1.37rem;
            height: 0.25rem;
            margin: 0.46rem auto 0 0.25rem;
            width: 1rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-weight: bold;
            
        }
    
        .priceLine{
            height: 0.25rem;
            margin-left: 0.09rem;
            margin-top:0.3rem;
            display: flex;
            align-items: center;
            img.money{
                width: 0.16rem;
                height: 0.16rem;
            }

            span.price{
                width: 1.2rem;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                line-height: 0.25rem;
                font-size: 0.14rem;
                margin-left: 0.04rem;
                color:$themeOrange;
            }
        }
    }

}
    
</style>